package com.ptswitch.material.components;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;

import com.ptswitch.material.pages.contract.AddItems;

public class MaterialForContractSearchForm {
    @Parameter(defaultPrefix = BindingConstants.LITERAL, value = "_self")
    @Property
    private String target;
    @Parameter
    private long contractId;
    @Parameter
    @Property
    private String like;
    @InjectPage
    private AddItems searchMaterial;
    @Inject
    private Request request;

    @OnEvent(component = "search")
    Object search() {
        return searchMaterial.withInit(contractId, like, 50, 1);
    }

}
